﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<RegisterModel>" %>

<asp:Content ID="registerTitle" ContentPlaceHolderID="TitleContent" runat="server">
    Register
</asp:Content>

<asp:Content ID="registerContent" ContentPlaceHolderID="MainContent" runat="server">
    
    <%= Html.ValidationSummary("帐户创建失败。请更正错误，然后再试一次。")%>
    <% using (Html.BeginForm("Register", "Account", FormMethod.Post, new { id = "registerForm" }))
       { %>
        <div>
            <fieldset>
                <legend>新用户注册</legend>
                <p>
                    密码长度必须是 6-10 位之间。
                </p>
                <p>
                    <%= Html.LabelFor(m => m.UserName) %> <em class="red">*</em><br />
                    <%= Html.TextBoxFor(m => m.UserName) %>
                    <%= Html.ValidationMessageFor(m => m.UserName) %>
                </p>
                <p>
                    <%= Html.LabelFor(m => m.Email) %> <em class="red">*</em><br />
                    <%= Html.TextBoxFor(m => m.Email) %>
                    <%= Html.ValidationMessageFor(m => m.Email) %>
                </p>
                <p>
                    <%= Html.LabelFor(m => m.Password) %> <em class="red">*</em><br />
                    <%= Html.Password("Password") %>
                    <%= Html.ValidationMessageFor(m => m.Password) %>
                </p>
                <p>
                    <%= Html.LabelFor(m => m.ConfirmPassword) %> <em class="red">*</em><br />
                    <%= Html.Password("ConfirmPassword") %>
                    <%= Html.ValidationMessageFor(m => m.ConfirmPassword) %>
                </p>
                <p>
                    <input type="submit" value="注册" />
                </p>
                <p>
                    <input type="hidden" name="<%= ViewData["key"]%>" id="<%= ViewData["key"]%>" value="<%= ViewData["value"]%>" />
                </p>
            </fieldset>
        </div>
    <% } %>
    <script language="javascript" type="text/javascript">
        $("#registerForm").validate({
            rules: {
                "UserName": { required: true, rangelength: [6, 10] },
                "Email": { required: true, email: true },
                "Password": { required: true, rangelength: [6, 10] },
                "ConfirmPassword": { required: true, rangelength: [6, 10], equalTo: "#Password" }
            },
            messages: {
                "UserName": { required: "请输入用户名。", rangelength: "用户名长度介于 6 和 10 之间的字符串。" },
                "Email": { required: "请输入Email。", email: "请输入正确的Email。" },
                "Password": { required: "请输入密码。", rangelength: "密码长度介于 6 和 10 之间的字符串。" },
                "ConfirmPassword": { required: "请输入验证码。", rangelength: "密码长度介于 6 和 10 之间的字符串。", equalTo: "密码与确认密码不相同。" }
            },
            onkeyup: false
        });
   </script>
</asp:Content>
<asp:Content ContentPlaceHolderID="HeadLink" ID="headLink" runat="server">
   <script language="javascript" type="text/javascript" src="<%=Url.Resources("jqmvf") %>"></script>
   <style type="text/css">
       form lable.err
       { 
       	 margin-left:20px;
       }
    </style>
</asp:Content>
